package cn.tedu;

import java.io.*;

public class Test1 {
    public static void main(String[] args) {
        method();
        method2();
    }
    private static void method() {
        InputStream i=null;//声明i 为了finally也能用
        try{
            i =new BufferedInputStream(System.in);
            int a=i.read();
            System.out.println(a);
        }catch(IOException x){
            x.printStackTrace();//打印错误信息(打印堆栈的跟踪信息)   开发阶段
            System.out.println("程序开小差拉~~");//项目上线时
        }finally{
         IOUtils.close(i);
        }

    }
    private static void method2(){
        OutputStream o=null;
        try {
            o=new BufferedOutputStream(System.out);
            o.write(92);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            IOUtils.close(o);
        }
    }
}
